﻿using System;
using System.Data;
using System.Collections.Generic;
using TestingToolkit;

namespace TestExecutor
{
    static class Program
    {
        private class MainMenu: AutoCommandLineMenu
        {
            public MainMenu()
            {
                InitializeData();
                Reader = Console.In;
                Writer = Console.Out;
            }

            private void InitializeData()
            {
                Header = "Main Menu";
                AddOption("Basic Database Tests", (x) => { BasicDatabase.BasicDBTests.ExecuteTests(); });
                AddOption("Excel OLE Tests", (x) => { ExcelToolsTests.ExcelOLETests.RunTests(); });
                AddOption("Excel Interop Tests", (x) => { ExcelToolsTests.ExcelInteropTests.RunTests(); });
            }
        }

        public static void PrintDataTable(DataTable table, System.IO.TextWriter ctrl_output)
        {
            ctrl_output.WriteLine("Printing Column Collection");
            foreach (DataColumn dcc in table.Columns)
            {
                ctrl_output.WriteLine("Column Name: {0}", dcc.ColumnName);
                ctrl_output.WriteLine("Data Type: {0}", dcc.DataType);
                ctrl_output.WriteLine();
            }

            ctrl_output.WriteLine();

            ctrl_output.WriteLine("Printing Row Collection");
            foreach (DataRow dr in table.Rows)
            {
                ctrl_output.Write("*");
                foreach (object o in dr.ItemArray)
                    ctrl_output.Write("{0}\t", o.ToString());
                ctrl_output.WriteLine();
            }
        }

        public static void Main()
        {
            MainMenu menu = new MainMenu();
            menu.Run();
        }
    }
}
